package cn.hp.controller;
import cn.hp.entity.RoleMenu;
import cn.hp.service.RoleMenuService;
import cn.hp.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/roleMenu")
public class RoleMenuController {
    @Autowired
    private RoleMenuService roleMenuService;

    @GetMapping("/getRoleMenu")
    public Result getMenu(RoleMenu roleMenu){
        List<RoleMenu> list = roleMenuService.selectRoleMenuList(roleMenu);
        Integer[] menuIds = new Integer[list.size()];
        for (int i = 0; i < list.size(); i++) {
            menuIds[i] = list.get(i).getMenuId();
        }
        return Result.success(menuIds);
    }
}
